UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZHaHcokW1EFUWpDXzXbS6TOWqm3ltctMnWh7V0STVnE=' 
WHERE 
  key_id = '73c617f7a6f32256174e73c96489350899370d0eac1656777ed10971a012e6ac' 
  AND (
    token = 'ZHaHcokW1EFUWpDXzXbS6TOWqm3ltctMnWh7V0STVnE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031