UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ub0oc/sqmCUskKmE/gboqahhLj/+z0nvNPBZ6Geh3kc=' 
WHERE 
  key_id = '51691b33e9aaf5029fab3064a522d005f2e3f750d8bfb267a2545a2aae7933fc' 
  AND (
    token = 'Ub0oc/sqmCUskKmE/gboqahhLj/+z0nvNPBZ6Geh3kc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044