UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EBxx+Kj5BA3jLZd/O6TyovdwWfovT9V3+TaBk+dyo9U='
WHERE
key_id = 'd2588a0b1c4120eea95668ff445f62eab0a61c315dba7134859f1ec7a51425ed'
AND (
token = 'EBxx+Kj5BA3jLZd/O6TyovdwWfovT9V3+TaBk+dyo9U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)