UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iawk6F8tH6zW+7aC92pxLXVMnIIltFNZkE8CYL6flKE='
WHERE
key_id = 'a3ddb317d09e2f20579b09a95bae18c5899dd59111e7ee984844f4991f1e7dd1'
AND (
token = 'iawk6F8tH6zW+7aC92pxLXVMnIIltFNZkE8CYL6flKE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)