UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lLSO0JcHgPTaTguXKz8aeV6+SXDXom54j6YbvEgi4jU=' 
WHERE 
  key_id = '7177fa3abc36030ac5117ce0beaf8e4904f997c6081a2529a15a6fe7396c950d' 
  AND (
    token = 'lLSO0JcHgPTaTguXKz8aeV6+SXDXom54j6YbvEgi4jU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034