UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '51XdjrdnW/xFOsOh2DSsEQXFkgUXdshhSMxa2dSWSOo='
WHERE
key_id = '0f0d9ed878e9aa4798d1f22cd46c10374011a1c8f825f0574d6b1122e8eddf05'
AND (
token = '51XdjrdnW/xFOsOh2DSsEQXFkgUXdshhSMxa2dSWSOo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)