UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Yc6Wk54XDEqddNylxysZeueegH262W0SyLa5fmO6D+o=' 
WHERE 
  key_id = '537d28d1962de69d36c20c86ae0dba1a010fe8102db1349310d34d8fa6617b92' 
  AND (
    token = 'Yc6Wk54XDEqddNylxysZeueegH262W0SyLa5fmO6D+o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045