UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NeyRYKQ3f6i5HUOuPT2qG4oTujYIC7SU1PMndfhBvgQ=' 
WHERE 
  key_id = 'fd56099048d2156edc18d6916f7e7df081deb0c2b7268e227fdaf40da8496b03' 
  AND (
    token = 'NeyRYKQ3f6i5HUOuPT2qG4oTujYIC7SU1PMndfhBvgQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025