UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YJhyBy8epAWjDH0lcvrpkMyigDyPfRXLJ7E4KjJhp0c=' 
WHERE 
  key_id = '000fd82b9009033da6b1f14579a7f61893e2a4907f5aee9da5f218516736a9e4' 
  AND (
    token = 'YJhyBy8epAWjDH0lcvrpkMyigDyPfRXLJ7E4KjJhp0c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068