UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BWYm+EuNEXMzaJ+q2z9rny4Di2n2XWsne/PcHdHCvzo=' 
WHERE 
  key_id = '08f8707c632a4c2001cd57807588bb69f17dde3f62fd7124fdbed129fbfb762e' 
  AND (
    token = 'BWYm+EuNEXMzaJ+q2z9rny4Di2n2XWsne/PcHdHCvzo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034