UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x0f0QutdDlWUzwh7aRv0rImWIlTpPMfq2LG8LNkwM+c=' 
WHERE 
  key_id = '7346728e10f402aaf577ce0957b0a3984759e08a320666200504a17a2873e68e' 
  AND (
    token = 'x0f0QutdDlWUzwh7aRv0rImWIlTpPMfq2LG8LNkwM+c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045