UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9r8hwSCnmVSRwsBbEnLAEgirq4Sa+ohkfhR8NANqzNU=' 
WHERE 
  key_id = 'ef307dcf2740e5253d0d4f2f9048c7ca794a9bd57da728432ac67707d733062b' 
  AND (
    token = '9r8hwSCnmVSRwsBbEnLAEgirq4Sa+ohkfhR8NANqzNU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052