UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KnnWru0Zo/niSAYMkBBpqZzLbpMMgjVCzDIVvFLXNss='
WHERE
key_id = 'bb62327b36ae88754453443a8f3ec2fb43565137e7e6afb60f7cd68ae36f007a'
AND (
token = 'KnnWru0Zo/niSAYMkBBpqZzLbpMMgjVCzDIVvFLXNss='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)