UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oS4qLGR0P5UqgrtwjuUyYk+rLnVgcF+EFGgx2pQ4Na0=' 
WHERE 
  key_id = 'bec6d682696d7eae9f47def00e93a0b2b83937cfc5284a36fbc68a68b0ebcf6a' 
  AND (
    token = 'oS4qLGR0P5UqgrtwjuUyYk+rLnVgcF+EFGgx2pQ4Na0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039