UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y9eDXDmnIk0Tk6nXWfcWmYLpLYcXXV8YWkycRvXo48c=' 
WHERE 
  key_id = '5c5912c4916c73538261d797faaf1338b333083da82854b97465876531bad075' 
  AND (
    token = 'Y9eDXDmnIk0Tk6nXWfcWmYLpLYcXXV8YWkycRvXo48c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030