UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rS55wpwDreHwCc5ae9LDalit/RRXNAHnUqaZjaci2IE='
WHERE
key_id = 'c5d822459485dd8bb8be348f9e5731a1a1e549d6eb83621e3043e0f7b2be3f5a'
AND (
token = 'rS55wpwDreHwCc5ae9LDalit/RRXNAHnUqaZjaci2IE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)