UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wMeQVGoRo2r9+cqja+uOGNaaSt04yYwOE5ZtuYHwyZE=' 
WHERE 
  key_id = 'b3ec8a89090702d3e250d52150067eb5a5093029a58c3b2693ed84c02e62e2b1' 
  AND (
    token = 'wMeQVGoRo2r9+cqja+uOGNaaSt04yYwOE5ZtuYHwyZE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037