UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zG5I2h2ATdj4wb4YMfUvS1QKQd3LuFRca8N97AYv64Y='
WHERE
key_id = '21a958c6883a0bc3a6885775c492f5a12e669e7a6916bb660f44b880d8a1e74a'
AND (
token = 'zG5I2h2ATdj4wb4YMfUvS1QKQd3LuFRca8N97AYv64Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)