UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U+AQ2nEComPU1Xod9nj3GhLh3zdPn6wTlWAzsRyFg1I=' 
WHERE 
  key_id = 'bb95fe4dd81804ebf2afaa26e8dfddf7937bbf93b0878f849f670e28ef56d825' 
  AND (
    token = 'U+AQ2nEComPU1Xod9nj3GhLh3zdPn6wTlWAzsRyFg1I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046