UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GdXc9TYPXpsfdP+feG0PjhNsP3J2mp9Jik+yWiITOok='
WHERE
key_id = '69c4de78303991089064a5ea239c37632c358cc4622cea20dc4d4e59e2ad71bf'
AND (
token = 'GdXc9TYPXpsfdP+feG0PjhNsP3J2mp9Jik+yWiITOok='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)