UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AuvF1gO84+aCHNyd27Fvxk0waqfM4Xq5ZXwA0SNGq34='
WHERE
key_id = 'ba54f2514f2003ec078914aa15a454b2a2cd117af0098872460a517e68577248'
AND (
token = 'AuvF1gO84+aCHNyd27Fvxk0waqfM4Xq5ZXwA0SNGq34='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)