UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8sNqIAinZi9t9doPfU1sB/XrnOsw4lJrOCsahak8fQk=' 
WHERE 
  key_id = '36982f02249aa0313b5a2519d3cddf6a79b20d3755bd40e6fb01e5b9ea9ed87d' 
  AND (
    token = '8sNqIAinZi9t9doPfU1sB/XrnOsw4lJrOCsahak8fQk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036