UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LaR1gXJDbdwppvgFyu8nZn1jVsjzWKb2b1wEZGZHSyg='
WHERE
key_id = '5ca3f1c8aec932f398df63be519f3b367b12d4c133b27ffc8ea676b2b398ca2d'
AND (
token = 'LaR1gXJDbdwppvgFyu8nZn1jVsjzWKb2b1wEZGZHSyg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)