UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NQjiRkcIVzrczMME7fyPOqMiSqaTt7j5k+t3lQK94ck='
WHERE
key_id = '3b49d60be7e77acf3f1a4c572c50553bc977d119c9fbc3a3fb42d3ea3f76fbce'
AND (
token = 'NQjiRkcIVzrczMME7fyPOqMiSqaTt7j5k+t3lQK94ck='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)