UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pYFNcZkY8K5YArhNrNsVQg2rLwsk2jHX6Qyx9rRuMsg=' 
WHERE 
  key_id = '6b1cf6cbec7e1613d4d00f6f3060c5dd1464cbc04d45a5cf8b8b5d674f70e393' 
  AND (
    token = 'pYFNcZkY8K5YArhNrNsVQg2rLwsk2jHX6Qyx9rRuMsg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028