UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9X1eDSh4Ar+uot+bucUTbkhjYvQBbcPX7WRejwKvX+s=' 
WHERE 
  key_id = '89c2eca3831aa194bc1b32a16800adbb6ae832fb785420315e881b1573687f3e' 
  AND (
    token = '9X1eDSh4Ar+uot+bucUTbkhjYvQBbcPX7WRejwKvX+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019