UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H3NyU1J4lik157iaGKp9SUp07h0vWiTI4Dxgou/j3pQ=' 
WHERE 
  key_id = '3774f7b773442c355028fb9a765e6db8ac7323eb276ff333cdc949920f03ded8' 
  AND (
    token = 'H3NyU1J4lik157iaGKp9SUp07h0vWiTI4Dxgou/j3pQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029