UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XR97aNI+mcuKIy5B/T+ans7oiLFJ+RA0yjQHQAhtE84=' 
WHERE 
  key_id = '86374359075a4798bb05ddda9e98f1c4df57823b5f708f1f0706a8dc85028068' 
  AND (
    token = 'XR97aNI+mcuKIy5B/T+ans7oiLFJ+RA0yjQHQAhtE84=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030