UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MyQvwRSFiDIv1jS1pKFBeoI+C/NggthILv0pbvVD0Os=' 
WHERE 
  key_id = '664804452e1668d62cee865ba8631396ec82ca0c21f4093cf8cbbaae59932f33' 
  AND (
    token = 'MyQvwRSFiDIv1jS1pKFBeoI+C/NggthILv0pbvVD0Os=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040