UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hJ5Ex1iqAaVFgC3aAhBx5u30xlGjyqsuEAiVGfa6r3M='
WHERE
key_id = 'd84d17dc8f3347ec340dad88f42b603a7ed5fdd72c0043f5aadd3badaf5dd8d5'
AND (
token = 'hJ5Ex1iqAaVFgC3aAhBx5u30xlGjyqsuEAiVGfa6r3M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)