UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BbsM9+NFT5uvALhpCWKdXDIuIUvjKgvCDEyCcX4wT+Q=' 
WHERE 
  key_id = 'a27b114c3830ce12e1e2ce6f9a7293aea54979ac7fa71693f59f0924e4de02d2' 
  AND (
    token = 'BbsM9+NFT5uvALhpCWKdXDIuIUvjKgvCDEyCcX4wT+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024